package com.example.demo.vo.board

import com.example.demo.dbmodels.TOperation
import java.time.LocalDateTime

class OperationVO {


    /**
     *  ID
     **/
    var id: Int? = null

    /**
     *  病区
     **/
    var district_code: String? = null

    /**
     *  科室
     **/
    var dept_code: String? = null

    /**
     *  病案号
     **/
    var patient_code: String? = null

    /**
     *  手术名称
     **/
    var op_name: String? = null

    /**
     *  手术部位
     **/
    var op_part: String? = null

    /**
     *  手术日期
     **/
    var op_date: LocalDateTime? = null

    /**
     *  手术时间
     **/
    var op_time: String? = null

    /**
     *  主刀医生
     **/
    var op_doc: String? = null

    /**
     *  助理医生1
     **/
    var assist_doc1: String? = null

    /**
     *  助理医生2
     **/
    var assist_doc2: String? = null

    /**
     *  助理医生3
     **/
    var assist_doc3: String? = null

    /**
     *  麻醉医生1
     **/
    var ans_doc1: String? = null

    /**
     *  麻醉医生2
     **/
    var asn_doc2: String? = null

    /**
     *  巡回护士1
     **/
    var cir_nurse1: String? = null

    /**
     *  巡回护士2
     **/
    var cir_nurse2: String? = null

    /**
     *  器械护士1
     **/
    var scr_nurse1: String? = null

    /**
     *  器械护士2
     **/
    var scr_nurse2: String? = null

    /**
     *  状态:0=取消,1=正常
     **/
    var status: Int? = null

    /**
     *  更新时间
     **/
    var update_time: LocalDateTime? = null

    /**
     *  更新人
     **/
    var update_by: Int? = null


    fun getOperationVO(table: TOperation?): OperationVO? {
        table?.apply {
            val data = OperationVO()
            data.ans_doc1 = ans_doc1
            data.asn_doc2 = asn_doc2
            data.assist_doc1 = assist_doc1
            data.assist_doc2 = assist_doc2
            data.assist_doc3 = assist_doc3
            data.cir_nurse1 = cir_nurse1
            data.cir_nurse2 = cir_nurse2
            data.dept_code = dept_code
            data.district_code = district_code
            data.id = id
            data.op_date = op_date
            data.op_doc = op_doc
            data.op_name = op_name
            data.op_part = op_part
            data.op_time = op_time
            data.patient_code = patient_code
            data.status = status
            data.update_by = update_by
            data.update_time = update_time
            return data
        }
        return null
    }

    fun getOperationListVo(table: List<TOperation>?): List<OperationVO>? {
        table?.apply {
            val datas = mutableListOf<OperationVO>()
            forEach {
                val data = OperationVO()
                data.ans_doc1 = it.ans_doc1
                data.asn_doc2 = it.asn_doc2
                data.assist_doc1 = it.assist_doc1
                data.assist_doc2 = it.assist_doc2
                data.assist_doc3 = it.assist_doc3
                data.cir_nurse1 = it.cir_nurse1
                data.cir_nurse2 = it.cir_nurse2
                data.dept_code = it.dept_code
                data.district_code = it.district_code
                data.id = it.id
                data.op_date = it.op_date
                data.op_doc = it.op_doc
                data.op_name = it.op_name
                data.op_part = it.op_part
                data.op_time = it.op_time
                data.patient_code = it.patient_code
                data.status = it.status
                data.update_by = it.update_by
                data.update_time = it.update_time
                datas.add(data)
            }
            return datas
        }
        return null
    }

}